package collect.taobao.action;

import java.util.ArrayList;
import java.util.List;

import javax.servlet.ServletContext;

import org.springframework.context.ApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

import collect.taobao.bean.CartoonStatBean;
import collect.taobao.service.CartoonStatService;
import collect.taobao.util.SuperAction;

public class CartoonStatAction  extends SuperAction{
	public List cartoonStatList = new ArrayList();
	public CartoonStatAction() {
		super();
	}

	public String executeXX(){
			ServletContext servletContext = this.getReq().getSession().getServletContext(); 
			ApplicationContext ctx=WebApplicationContextUtils.getWebApplicationContext(servletContext); 
			CartoonStatService service = (CartoonStatService) ctx.getBean("cartoonStatServerInterface");
			cartoonStatList = service.queryListOrderByclicks();//根据点击数排序查询
			for(int i = 0;i<cartoonStatList.size();i++){
				CartoonStatBean tmp = (CartoonStatBean) cartoonStatList.get(i);
				System.out.println(tmp.getId());
			}
			/*-------------------用于向表中添加测试数据 可删除-----------------------
			E_CLASSIFICATION[] classifications = E_CLASSIFICATION.values();
			for(int i = 0;i<classifications.length;i++){
				E_CLASSIFICATION tmp = classifications[i];
				CartoonStatBean stat = new CartoonStatBean();
				stat.setClassification(tmp.toString());
				stat.setDirectory("D:\\漫画\\"+tmp.getCH_name());
				stat.setName(tmp.getCH_name()+i);
				stat.setClicks(i);
				stat.setSynopsis(tmp.getEN_name()+"|"+tmp.getCH_name()+"|"+tmp.toString());
				service.save(stat);
			}
			*/
			return "success";
	}

}
